Back to the Vavoom Forum Archives
Durandal
Firebrand
Durandal
class ClericFlameMissile : Projectile;
float FlameSpeed;
Actor bmo;
//==========================================================================
//
// HitMobj
//
//==========================================================================
void HitMobj(Entity Other)
{
bmo = Actor(Other);
::HitMobj(Other);
bmo = none;
}
from Actor.vc:
//==========================================================================
//
// HitMobj
//
//==========================================================================
void HitMobj(Entity Other)
{
float angle;
if (bMissile)
{
if (bFloorBounce)
{
if (Actor(Other).bReflective || (!Other.bIsPlayer &&
!Actor(Other).bCountKill))
{
float speed;
angle = AngleMod360(atan2(Origin.y - Other.Origin.y,
Origin.x - Other.Origin.x) + Random() * 16.0 - 8.0);
speed = Length(Velocity);
speed = speed * 0.75;
Angles.yaw = angle;
Velocity.x = speed * cos(angle);
Velocity.y = speed * sin(angle);
if (SightSound)
{
PlaySound(SightSound, CHAN_VOICE);
}
}
else
{
// Struck a player/creature
ExplodeMissile();
}
return;
}
if (Actor(Other).bReflective)
{
angle = Actor(Other).GetReflectedAngle(self);
if (angle != -1.0)
{
// Reflect the missile along angle
Angles.yaw = angle;
Velocity.x = (Speed / 2.0) * cos(angle);
Velocity.y = (Speed / 2.0) * sin(angle);
// Velocity.z = -Velocity.z;
if (bSeekerMissile)
{
Enemy = Instigator;
}
Instigator = Actor(Other);
return;
}
}
// Explode a missile
ExplodeMissile();
}
else
{
if (bSlide)
{
// Try to slide along it
// Slide against mobj
// if (TryMove(vector(Origin.x, ptryy, Origin.z)))
if (TryMove(vector(Origin.x, Origin.y + Velocity.y * Level.Game.frametime, Origin.z)))
{
Velocity.x = 0.0;
}
// else if (TryMove(vector(ptryx, Origin.y, Origin.z)))
else if (TryMove(vector(Origin.x + Velocity.x * Level.Game.frametime, Origin.y, Origin.z)))
{
Velocity.y = 0.0;
}
else
{
Velocity.x = 0.0;
Velocity.y = 0.0;
}
}
else
{
Velocity.x = 0.0;
Velocity.y = 0.0;
}
}
}
and back to ClericFlameMissile.vc:
//============================================================================
//
// A_CFlameMissile
//
//============================================================================
void A_CFlameMissile()
{
int i;
float an;
float dist;
Actor A;
A_UnHideThing();
PlaySound('ClericFlameExplode', CHAN_VOICE);
if (bmo && bmo.bShootable)
{
// Hit something, so spawn the flame circle around the thing
dist = bmo.Radius + 18.0;
for (i = 0; i < 4; i++)
{
an = itof(i) * 45.0;
A = Spawn(CircleFlame, bmo.Origin +
vector(dist * cos(an), dist * sin(an), 5.0));
if (A)
{
A.Angles.yaw = an;
A.Instigator = Instigator;
A.Velocity.x = FlameSpeed * cos(an);
A.Velocity.y = FlameSpeed * sin(an);
A.Special1f = A.Velocity.x;
A.Special2f = A.Velocity.y;
A.StateTime -= Random() * 0.1;
}
A = Spawn(CircleFlame, bmo.Origin +
vector(-dist * cos(an), -dist * sin(an), 5.0));
if (A)
{
A.Angles.yaw = AngleMod360(180.0 + an);
A.Instigator = Instigator;
A.Velocity.x = -FlameSpeed * cos(an);
A.Velocity.y = -FlameSpeed * sin(an);
A.Special1f = A.Velocity.x;
A.Special2f = A.Velocity.y;
A.StateTime -= Random() * 0.1;
}
}
SetState(S_FLAMEPUFF2_1);
}
}scen
Durandal
Janis Legzdinsh